//
//  MoreViewController.m
//  旅游咨询
//
//  Created by 徐斌 on 15/4/13.
//  Copyright (c) 2015年 xubin. All rights reserved.
//

#import "MoreViewController.h"

@interface MoreViewController ()

@end

@implementation MoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    
    self.myArray = [NSMutableArray arrayWithObjects:@"夜间模式", @"版本更新", @"清除缓存", @"关于我们", nil];
    
    [self.view addSubview:self.myTableView];
    
//    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 600)];
//    //headView.backgroundColor = [UIColor greenColor];
//    [self.myTableView addSubview:headView];
//    self.myTableView.tableHeaderView = headView;
    UIImageView *myHeadView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
    myHeadView.backgroundColor = [UIColor yellowColor];
    self.myTableView.tableHeaderView = myHeadView;
    
}
// 清除缓存 关于我们 夜间模式 版本更新 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    static NSString *cellIdentifier = @"cell";
//    MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
//    if (cell == nil) {
//        cell = [[MyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
//    }
//    HotsiteListModel *model = [self.allModelArray objectAtIndex:indexPath.section];
//    cell.myModel = model;
//    return cell;
    static NSString *cellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    
//    if (indexPath.row == 0) {
//        <#statements#>
//    }
    
    
    
    NSString *str = [self.myArray objectAtIndex:indexPath.row];
    cell.textLabel.text = str;
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.row == 1) {
        UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"已经是最新版本(⊙o⊙)哦" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [myAlert show];
    }
    if (indexPath.row == 2) {
        [[DataBaseHandle shareDataBaseHandel]openDB];
        [[DataBaseHandle shareDataBaseHandel]dropAllErop];
        [[DataBaseHandle shareDataBaseHandel]dropAllAsia];
        
        [[SDImageCache sharedImageCache]cleanDisk];
        
        CGFloat size = [[SDImageCache sharedImageCache]getSize];
        
        UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"清除缓存" delegate:self cancelButtonTitle:@"取消"otherButtonTitles:@"确定", nil];
        [myAlert show];
    }
    if (indexPath.row == 3) {
        AboutViewController *aboutVC = [[AboutViewController alloc] init];
        UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:aboutVC];
        [self.navigationController presentViewController:naVC animated:YES completion:^{
            
            
        }];
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
